package o;

import com.huawei.hwid.core.constants.HwAccountConstants;
import java.io.IOException;
import java.io.Reader;
import java.util.Iterator;
import java.util.Map.Entry;

public final class auj extends auy {
    private static final Reader ˋ = new Reader() {
        public int read(char[] cArr, int i, int i2) throws IOException {
            throw new AssertionError();
        }

        public void close() throws IOException {
            throw new AssertionError();
        }
    };
    private static final Object ˏ = new Object();
    private int[] ʻ;
    private String[] ʽ;
    private Object[] ˊ;
    private int ˎ;

    public void ˊ() throws IOException {
        ˏ(auz.BEGIN_ARRAY);
        ˎ(((atg) ॱˋ()).iterator());
        this.ʻ[this.ˎ - 1] = 0;
    }

    public void ˎ() throws IOException {
        ˏ(auz.END_ARRAY);
        ˈ();
        ˈ();
        if (this.ˎ > 0) {
            int[] iArr = this.ʻ;
            int i = this.ˎ - 1;
            iArr[i] = iArr[i] + 1;
        }
    }

    public void ॱ() throws IOException {
        ˏ(auz.BEGIN_OBJECT);
        ˎ(((atk) ॱˋ()).ˊॱ().iterator());
    }

    public void ˏ() throws IOException {
        ˏ(auz.END_OBJECT);
        ˈ();
        ˈ();
        if (this.ˎ > 0) {
            int[] iArr = this.ʻ;
            int i = this.ˎ - 1;
            iArr[i] = iArr[i] + 1;
        }
    }

    public boolean ˋ() throws IOException {
        auz ʻ = ʻ();
        return (ʻ == auz.END_OBJECT || ʻ == auz.END_ARRAY) ? false : true;
    }

    public auz ʻ() throws IOException {
        if (this.ˎ == 0) {
            return auz.END_DOCUMENT;
        }
        Object ॱˋ = ॱˋ();
        if (ॱˋ instanceof Iterator) {
            boolean z = this.ˊ[this.ˎ - 2] instanceof atk;
            Iterator it = (Iterator) ॱˋ;
            if (!it.hasNext()) {
                return z ? auz.END_OBJECT : auz.END_ARRAY;
            } else {
                if (z) {
                    return auz.NAME;
                }
                ˎ(it.next());
                return ʻ();
            }
        } else if (ॱˋ instanceof atk) {
            return auz.BEGIN_OBJECT;
        } else {
            if (ॱˋ instanceof atg) {
                return auz.BEGIN_ARRAY;
            }
            if (ॱˋ instanceof atj) {
                atj o_atj = (atj) ॱˋ;
                if (o_atj.ॱˎ()) {
                    return auz.STRING;
                }
                if (o_atj.ˊॱ()) {
                    return auz.BOOLEAN;
                }
                if (o_atj.ॱˋ()) {
                    return auz.NUMBER;
                }
                throw new AssertionError();
            } else if (ॱˋ instanceof atl) {
                return auz.NULL;
            } else {
                if (ॱˋ == ˏ) {
                    throw new IllegalStateException("JsonReader is closed");
                }
                throw new AssertionError();
            }
        }
    }

    private Object ॱˋ() {
        return this.ˊ[this.ˎ - 1];
    }

    private Object ˈ() {
        Object[] objArr = this.ˊ;
        int i = this.ˎ - 1;
        this.ˎ = i;
        Object obj = objArr[i];
        this.ˊ[this.ˎ] = null;
        return obj;
    }

    private void ˏ(auz o_auz) throws IOException {
        if (ʻ() != o_auz) {
            throw new IllegalStateException("Expected " + o_auz + " but was " + ʻ() + ʽॱ());
        }
    }

    public String ᐝ() throws IOException {
        ˏ(auz.NAME);
        Entry entry = (Entry) ((Iterator) ॱˋ()).next();
        String str = (String) entry.getKey();
        this.ʽ[this.ˎ - 1] = str;
        ˎ(entry.getValue());
        return str;
    }

    public String ʽ() throws IOException {
        auz ʻ = ʻ();
        if (ʻ == auz.STRING || ʻ == auz.NUMBER) {
            String ˏ = ((atj) ˈ()).ˏ();
            if (this.ˎ > 0) {
                int[] iArr = this.ʻ;
                int i = this.ˎ - 1;
                iArr[i] = iArr[i] + 1;
            }
            return ˏ;
        }
        throw new IllegalStateException("Expected " + auz.STRING + " but was " + ʻ + ʽॱ());
    }

    public boolean ʼ() throws IOException {
        ˏ(auz.BOOLEAN);
        boolean ʻ = ((atj) ˈ()).ʻ();
        if (this.ˎ > 0) {
            int[] iArr = this.ʻ;
            int i = this.ˎ - 1;
            iArr[i] = iArr[i] + 1;
        }
        return ʻ;
    }

    public void ॱॱ() throws IOException {
        ˏ(auz.NULL);
        ˈ();
        if (this.ˎ > 0) {
            int[] iArr = this.ʻ;
            int i = this.ˎ - 1;
            iArr[i] = iArr[i] + 1;
        }
    }

    public double ॱˊ() throws IOException {
        auz ʻ = ʻ();
        if (ʻ == auz.NUMBER || ʻ == auz.STRING) {
            double ˋ = ((atj) ॱˋ()).ˋ();
            if (ʻॱ() || !(Double.isNaN(ˋ) || Double.isInfinite(ˋ))) {
                ˈ();
                if (this.ˎ > 0) {
                    int[] iArr = this.ʻ;
                    int i = this.ˎ - 1;
                    iArr[i] = iArr[i] + 1;
                }
                return ˋ;
            }
            throw new NumberFormatException("JSON forbids NaN and infinities: " + ˋ);
        }
        throw new IllegalStateException("Expected " + auz.NUMBER + " but was " + ʻ + ʽॱ());
    }

    public long ͺ() throws IOException {
        auz ʻ = ʻ();
        if (ʻ == auz.NUMBER || ʻ == auz.STRING) {
            long ˊ = ((atj) ॱˋ()).ˊ();
            ˈ();
            if (this.ˎ > 0) {
                int[] iArr = this.ʻ;
                int i = this.ˎ - 1;
                iArr[i] = iArr[i] + 1;
            }
            return ˊ;
        }
        throw new IllegalStateException("Expected " + auz.NUMBER + " but was " + ʻ + ʽॱ());
    }

    public int ˏॱ() throws IOException {
        auz ʻ = ʻ();
        if (ʻ == auz.NUMBER || ʻ == auz.STRING) {
            int ˎ = ((atj) ॱˋ()).ˎ();
            ˈ();
            if (this.ˎ > 0) {
                int[] iArr = this.ʻ;
                int i = this.ˎ - 1;
                iArr[i] = iArr[i] + 1;
            }
            return ˎ;
        }
        throw new IllegalStateException("Expected " + auz.NUMBER + " but was " + ʻ + ʽॱ());
    }

    public void close() throws IOException {
        this.ˊ = new Object[]{ˏ};
        this.ˎ = 1;
    }

    public void ˋॱ() throws IOException {
        if (ʻ() == auz.NAME) {
            ᐝ();
            this.ʽ[this.ˎ - 2] = HwAccountConstants.NULL;
        } else {
            ˈ();
            if (this.ˎ > 0) {
                this.ʽ[this.ˎ - 1] = HwAccountConstants.NULL;
            }
        }
        if (this.ˎ > 0) {
            int[] iArr = this.ʻ;
            int i = this.ˎ - 1;
            iArr[i] = iArr[i] + 1;
        }
    }

    public String toString() {
        return getClass().getSimpleName();
    }

    public void ˊॱ() throws IOException {
        ˏ(auz.NAME);
        Entry entry = (Entry) ((Iterator) ॱˋ()).next();
        ˎ(entry.getValue());
        ˎ(new atj((String) entry.getKey()));
    }

    private void ˎ(Object obj) {
        if (this.ˎ == this.ˊ.length) {
            Object obj2 = new Object[(this.ˎ * 2)];
            Object obj3 = new int[(this.ˎ * 2)];
            Object obj4 = new String[(this.ˎ * 2)];
            System.arraycopy(this.ˊ, 0, obj2, 0, this.ˎ);
            System.arraycopy(this.ʻ, 0, obj3, 0, this.ˎ);
            System.arraycopy(this.ʽ, 0, obj4, 0, this.ˎ);
            this.ˊ = obj2;
            this.ʻ = obj3;
            this.ʽ = obj4;
        }
        Object[] objArr = this.ˊ;
        int i = this.ˎ;
        this.ˎ = i + 1;
        objArr[i] = obj;
    }

    public String ॱˎ() {
        StringBuilder append = new StringBuilder().append('$');
        int i = 0;
        while (i < this.ˎ) {
            if (this.ˊ[i] instanceof atg) {
                i++;
                if (this.ˊ[i] instanceof Iterator) {
                    append.append('[').append(this.ʻ[i]).append(']');
                }
            } else if (this.ˊ[i] instanceof atk) {
                i++;
                if (this.ˊ[i] instanceof Iterator) {
                    append.append('.');
                    if (this.ʽ[i] != null) {
                        append.append(this.ʽ[i]);
                    }
                }
            }
            i++;
        }
        return append.toString();
    }

    private String ʽॱ() {
        return " at path " + ॱˎ();
    }
}
